<#import '/ftlLibrary/properteisVariable.ftl' as pv/>
<style>
    .bootbox-close-button {
        width: 19px;
        height: 19px;
        border: none;
        cursor: pointer;
        -webkit-appearance: none;
        float: right;
        top: 4px;
        left: -5px;
        position: relative;
        background: #E9F5FF url("assets/img/nav-img/icon_close.png") no-repeat 0 0;
    }
    .tssClassRoomEdit .modal-dialog {
        width: 60% !important;
    }

    .tssClassRoomEdit .modal-body {
        padding-bottom: 0;
    }
    input[type='text'],select{
        height: 30px!important;
        border-radius: 5px!important;
    }
</style>
<div class="col-lg-12 col-sm-12 col-xs-12">
    <div class="widget">
        <div class="modal-header">
            <button type="button" class="bootbox-close-button close" data-dismiss="modal" aria-hidden="true">×</button>
            <h4 class="modal-title">${(editModel=='add')?string('新增教室','修改教室')}</h4>
        </div>

        <div class="modal-body" style="padding-top: 0px!important">
            <div class="row">
                <form class="editForm" action="${saveUrl}" method="post" responseType="JSON" role="form"
                      id="editForm_${serializeNum}"
                      data-bv-submitButtons="#editFormSubmitBtn_${serializeNum}"
                      data-bv-message="This value is not valid"
                      data-bv-feedbackicons-valid="glyphicon glyphicon-ok"
                      data-bv-feedbackicons-invalid="glyphicon glyphicon-remove"
                      data-bv-feedbackicons-validating="glyphicon glyphicon-refresh">
                    <input type="hidden" name="id" value="${editEntity.id}">
                    <input type="hidden" name="isBlockUp"  value="${editEntity.isBlockUp}">

                    <#if (true && editModel=='add')||(true && editModel=='edit')>
                        <div class="col-xm-12 col-sm-12 col-lg-12 margin-bottom-20 margin-top-30">
                            <div class="form-group" style="overflow: hidden;">
                                <label for="className" class="col-xm-5 col-sm-5 col-lg-5 control-label no-padding-right text-align-right"><span style="color: red">*</span>教室名称：</label>
                                <div class="col-xm-4 col-sm-4 col-lg-4">
                                    <select class="form-control" name="name" id="className" required="required"

                                            data-bv-remote="true"
                                            data-bv-remote-url="tssClassRoomController/verificationRoomName.do?id=${editEntity.id}"
                                            data-bv-remote-message="教室名称已存在！" required="required"
                                            data-bv-message="请填写教室名称！" maxlength="12"  alt="教室名称"
                                            placeholder="账号名称" type="text" title="教室名称"
                                            value="${editEntity.name}"

                                    >
                                        <option value="">请选择</option>
                                        <@dictionary groupCode="className";dics>
                                        <#list dics as dic>
                                            <#if editEntity.name == dic.code>
                                                <option value="${dic.code}" selected="selected">${dic.value}</option>
                                            <#else>
                                                <option value="${dic.code}">${dic.value}</option>
                                            </#if>
                                        </#list>
                                    </@dictionary>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </#if>
                    
                    <#if (true && editModel=='add')||(true && editModel=='edit')>
                        <div class="col-xm-12 col-sm-12 col-lg-12 margin-bottom-20">
                            <div class="form-group" style="overflow: hidden">
                                <label for="principal" class="col-xm-5 col-sm-5 col-lg-5 control-label no-padding-right text-align-right">教室负责人：</label>
                                <div class="col-xm-4 col-sm-4 col-lg-4">
                                    <input data-bv-message="The field is not valid" size="32" name="principal"
                                           alt="教室负责人" id="principal" placeholder="教室负责人" type="text" title="教室负责人"
                                           class="form-control" value="${editEntity.principal}"/>
                                    <span class="text"></span>
                                </div>
                            </div>
                        </div>
                    </#if>

                    <#if (flase && editModel=='add')||(flase && editModel=='edit')>
                        <div class="col-xm-12 col-sm-12 col-lg-12 text-align-center margin-bottom-20">
                            <div class="form-group">
                                <label for="status" class="col-sm-3 col-sm-offset-1 control-label no-padding-right">状态</label>
                                <div class="col-sm-6">
                                    <input data-bv-integer-message="The field is number"
                                           data-bv-message="The field is not valid" data-bv-integer="true" size="11"
                                           name="status" alt="状态" id="status" placeholder="状态" type="text" title="状态"
                                           class="form-control" value="${editEntity.status}"/>
                                    <span class="text"></span>
                                </div>
                            </div>
                        </div>
                    </#if>
                    <#if (flase && editModel=='add')||(flase && editModel=='edit')>
                        <div class="col-xm-12 col-sm-12 col-lg-12 text-align-center margin-bottom-20">
                            <div class="form-group">
                                <label for="empId" class="col-sm-3 col-sm-offset-1 control-label no-padding-right">当前操作者</label>
                                <div class="col-sm-6">
                                    <input data-bv-message="The field is not valid" size="32" name="empId" alt="当前操作者"
                                           id="empId" placeholder="当前操作者" type="text" title="当前操作者" class="form-control"
                                           value="${editEntity.empId}"/>
                                    <span class="text"></span>
                                </div>
                            </div>
                        </div>
                    </#if>
                    <#if (flase && editModel=='add')||(flase && editModel=='edit')>
                        <div class="col-xm-12 col-sm-12 col-lg-12 text-align-center margin-bottom-20">
                            <div class="form-group">
                                <label for="createTime" class="col-sm-3 col-sm-offset-1 control-label no-padding-right">创建时间</label>
                                <div class="col-sm-6">
										<span class="input-icon icon-left">
											<input data-bv-date-format="YYYY-MM-DD hh:mm:ss"
                                                   data-bv-message="The field is not valid"
                                                   data-bv-date-message="请正确输入一个时间" data-bv-date="true" size="19"
                                                   name="createTime" alt="创建时间" id="createTime" placeholder="创建时间"
                                                   type="text" title="创建时间"
                                                   class="form-control form-control date-picker"
                                                   onfocus="WdatePicker({doubleCalendar:true,dateFmt:'yyyy-MM-dd HH:mm:ss'})"
                                                   value="${editEntity.createTime}"/>
											<i class="fa fa-calendar"></i>
										</span>
                                </div>
                            </div>
                        </div>
                    </#if>
                    <#if (flase && editModel=='add')||(flase && editModel=='edit')>
                        <div class="col-xm-12 col-sm-12 col-lg-12 text-align-center margin-bottom-20">
                            <div class="form-group">
                                <label for="updateTime" class="col-sm-3 col-sm-offset-1 control-label no-padding-right">修改时间</label>
                                <div class="col-sm-6">
										<span class="input-icon icon-left">
											<input data-bv-date-format="YYYY-MM-DD hh:mm:ss"
                                                   data-bv-message="The field is not valid"
                                                   data-bv-date-message="请正确输入一个时间" data-bv-date="true" size="19"
                                                   name="updateTime" alt="修改时间" id="updateTime" placeholder="修改时间"
                                                   type="text" title="修改时间"
                                                   class="form-control form-control date-picker"
                                                   onfocus="WdatePicker({doubleCalendar:true,dateFmt:'yyyy-MM-dd HH:mm:ss'})"
                                                   value="${editEntity.updateTime}"/>
											<i class="fa fa-calendar"></i>
										</span>
                                </div>
                            </div>
                        </div>
                    </#if>
                    <#if (false && editModel=='add')||(false && editModel=='edit')>
                        <div class="col-xm-12 col-sm-12 col-lg-12 text-align-center margin-bottom-20">
                            <div class="form-group">
                                <label for="version" class="col-sm-3 col-sm-offset-1 control-label no-padding-right">版本</label>
                                <div class="col-sm-6">
                                    <input data-bv-integer-message="The field is number"
                                           data-bv-message="The field is not valid" data-bv-integer="true" size="11"
                                           name="version" alt="版本" id="version" placeholder="版本" type="text" title="版本"
                                           class="form-control" value="${editEntity.version}"/>
                                    <span class="text"></span>
                                </div>
                            </div>
                        </div>
                    </#if>
                    <div class="col-xm-12 col-sm-12 col-lg-12 margin-bottom-30">
                        <div class="text-align-center ">
                            <button style="min-width: 80px;margin-right:20px;" type="submit" class="btn btn-blue" id="editFormSubmitBtn_${serializeNum}">确定
                            </button>
                            <button style="width: 80px" type="button" class="btn btn-blue" data-dismiss="modal">取消</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script src="assets/js/validation/bootstrapValidator_init.js"></script>
<script>
    $(".selectpicker_${serializeNum}").select2();

    $("#editForm_${serializeNum}").bind("ajaxSubmitCallback", function (event, result) {
        if (result.resCode == 200) {
            bootbox.hideAll();
            logger.info(result.resMsg, true);
            toView('tssClassRoomController/tssClassRoomList.do',true,'POST',{pageSize:10})
        } else {
            logger.error(result.resMsg);
        }
    });
</script>